<!DOCTYPE html>
<script>
    window.bayeDebugMode = window.location.href.match(/(localhost|debug=1)/);
    //goHomeIfNeeded
    (function() {
        if (!bayeDebugMode) {
            match = window.location.hash.match(/#([0-9]*)/i);
            if(match){
                var ts = parseInt(match[1]);
                var now = new Date().getTime() / 1000;
                var dt = now - ts;
                if (ts && 0 <= dt && dt < 3600) {
                    return;
                }
            }
            window.location.href = "index.html";
        }
    })();
</script>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>三国霸业</title>
        <link rel="stylesheet" type="text/css" href="baye.css" />
        <link rel="icon" href="favicon.png">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
        <meta name="apple-mobile-web-app-capable" content="yes"/>
        <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
        <meta name="apple-touch-fullscreen" content="yes"/>
        <meta name="apple-mobile-web-app-title" content="三国霸业">
        <meta name="full-screen" content="yes"><!-- UC强制全屏 -->
        <meta name="x5-fullscreen" content="true"><!-- QQ强制全屏 -->
        <meta name="browsermode" content="application"><!-- UC应用模式 -->
        <meta name="x5-page-mode" content="app"><!-- QQ应用模式 -->
        <meta name="msapplication-tap-highlight" content="no"><!-- windows phone 点击无高光 -->
        <link rel="apple-touch-icon-precomposed" sizes="57x57" href="favicon.png"><!-- iPhone 和 iTouch，默认 57x57 像素，必须有 -->
        <link rel="apple-touch-icon-precomposed" sizes="72x72" href="favicon.png">
        <link rel="apple-touch-icon-precomposed" sizes="114x114" href="favicon.png"><!-- Retina iPhone 和 Retina iTouch，114x114 像素，可以没有，但推荐有 -->
        <link rel="apple-touch-icon-precomposed" sizes="144x144" href="favicon.png"><!-- Retina iPad，144x144 像素，可以没有，但推荐有 --><!-- iOS 图标 end -->
        <style>
            body {
                overflow: hidden;
                margin:0px;
            }
            #info {
                float:left;
                position: fixed;
                left: 0;
                top: 0;
                background: white;
                opacity: 0.8;
                pointer-events:none;
            }
        </style>
        <script>
            var _hmt = _hmt || [];
            (function() {
                var hm = document.createElement("script");
                hm.src = "//hm.baidu.com/hm.js?55cdc246d0c836cecfdf39ce0d5657f3";
                var s = document.getElementsByTagName("script")[0];
                s.parentNode.insertBefore(hm, s);
            })();
        </script>
        <script src="js/jquery.min.js"></script>
        <script src="js/encoding-indexes.js"></script>
        <script src="js/encoding.js"></script>
        <script src="js/sprintf.js"></script>
        <script src="js/lzma_worker-min.js"></script>
        <script src="js/base64.js"></script>
    </head>
    <body>
        <canvas id="lcd" width="160" height="96">然而你的浏览器并不支持HTML5</canvas>
        <div id="info"></div>
    </body>
</html>
<script src="js/bridge.js?ver=201801201234"></script>
<script src="js/lcd.js?ver=11"></script>
<script src="js/baye.js?ver=201801201234"></script>
<script>
lcdInit();


function reloadLCD(){
    var height = window.innerHeight;
    var width = window.innerWidth;
    console.log(height,width);

    if (height > width) {
        console.log('竖屏状态');
        $("#lcd").css({
            'height': width + 'px', 
            'width': height + 'px',
            'transform-origin' : 'left top',
            'transform' : 'rotate(-90deg) translateX(-' + height + 'px)',
        });
        lcdRotateMode = 2;
    } else {
        console.log('横屏状态');
        $("#lcd").css({
            'height' : height + 'px',
            'width' : width + 'px',
            '-webkit-transform' : 'rotate(0deg)',
            'transform' : 'rotate(0deg)',
        }); 
        lcdRotateMode = 0;
    }
}


(function (){
    touchScreenInit("lcd");
    reloadLCD();

    //判断手机横竖屏状态：
    window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", function() {
        reloadLCD();
    }, false);

    $(window).resize(reloadLCD);

    if (bayeDebugMode) {
        $("#info").show();
    } else {
        $("#info").hide();
    }
    bayeMain();
})();

</script>
